package custom;

import java.io.IOException;
import java.util.ResourceBundle;

import javax.faces.context.FacesContext;
import org.primefaces.component.api.UIData;

public class LastPageLinkRendererC extends PageLinkRendererCustom implements
		PaginatorElementRendererCustom {

	ResourceBundle rb = ResourceBundle
			.getBundle("com.davivienda.oneclick.bundle.messages");

	public void render(FacesContext context, UIData uidata) throws IOException {
		int currentPage = uidata.getPage();
		int pageCount = uidata.getPageCount();

		boolean disabled = (currentPage == (pageCount - 1))
				|| (currentPage == 0 && pageCount == 0);

		super.render(context, uidata, UIData.PAGINATOR_LAST_PAGE_LINK_CLASS,
				UIData.PAGINATOR_LAST_PAGE_ICON_CLASS, disabled,
				rb.getString("ultima") + " >>");
	}
}
